package JAVASE515;

public class JAVAcopy {
    public static void main(String[] argc){
        int[] arr={1,2,44,5,45,6567};
        int[] arr2=copyOfRange(arr,2,5);
        for (int i = 0; i < arr2.length; i++) {
            System.out.print(arr2[i]+" ");
        }
    }
    public static int[] copyOfRange(int[] arr,int from,int to){
        int[] arr2=new int[to-from];
        int temp=from;
        for (int i = 0; i < arr2.length; i++) {
            arr2[i]=arr[temp];
            temp++;
        }
        return arr2;
    }
}